package com.goodflower.goodflower.creat_mac;

import android.content.Intent;
import android.support.v7.app.AppCompatActivity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.EditText;
import android.widget.Toast;

import com.goodflower.goodflower.R;

public class Creat_mac_four extends AppCompatActivity {
    private EditText creat_mac_jt; //定时浇水事件间隔
    private EditText creat_mac_pt;//定时喷雾时间间隔
    private Button btn_creat_mac_four_next;//下一页按钮
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.creat_mac_four);
        //获取控件
        creat_mac_jt = (EditText)findViewById(R.id.creat_mac_jt);
        creat_mac_pt = (EditText)findViewById(R.id.creat_mac_pt);
        btn_creat_mac_four_next = (Button)findViewById(R.id.btn_creat_mac_four_next);
        //获取上一个页面的值
        Intent from_three_intent = getIntent();
        final String mac_name = from_three_intent.getStringExtra("mac_name");
        final String mac_mac = from_three_intent.getStringExtra("mac_mac");
        final String mac_kongshi = from_three_intent.getStringExtra("mac_kongshi");
        final String mac_kongwen = from_three_intent.getStringExtra("mac_kongwen");
        //按钮点击
        btn_creat_mac_four_next.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                Intent intent = new Intent(Creat_mac_four.this, Creat_mac_five.class);
                String mac_jt = creat_mac_jt.getText().toString();
                String mac_pt = creat_mac_pt.getText().toString();
                if(mac_jt==null||mac_pt==null||mac_jt.isEmpty()||mac_pt.isEmpty()){
                    Toast.makeText(Creat_mac_four.this,"您必须设定普通模式下数据",Toast.LENGTH_LONG).show();
                }else {
                    intent.putExtra("mac_name",mac_name);
                    intent.putExtra("mac_mac",mac_mac);
                    intent.putExtra("mac_kongshi",mac_kongshi);
                    intent.putExtra("mac_kongwen",mac_kongwen);
                    intent.putExtra("mac_jt",mac_jt);
                    intent.putExtra("mac_pt",mac_pt);
                    startActivity(intent);

                }
            }
        });
    }
}
